/*
 * @Author: ziqi jhzq12345678
 * @Date: 2024-11-29 17:37:38
 * @LastEditors: ziqi jhzq12345678
 * @LastEditTime: 2025-01-17 15:23:21
 * @FilePath: /pornhub_app/lib/src/components/play_list_cell/play_list_cell.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pornhub_app/assets/styles.dart';
import 'package:pornhub_app/components/image_view.dart';
import 'package:pornhub_app/model/blogger/blogger_video_collection.dart';
import 'package:pornhub_app/routes/routes.dart';
import 'package:pornhub_app/utils/color.dart';
import 'package:pornhub_app/utils/extension.dart';

class PlayListCell extends StatelessWidget {
  final BloggerVideoCollectionModel model;
  final bool haveBg;

  const PlayListCell({super.key, required this.model, this.haveBg = false});
  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Row(
          children: [
            Stack(
              children: [
                Container(
                  width: 114.w,
                  height: 114.w,
                  clipBehavior: Clip.hardEdge,
                  decoration:
                      BoxDecoration(borderRadius: BorderRadius.circular(8.w)),
                  child: ImageView(src: model.coverImg),
                ),
                Positioned(
                    bottom: 0,
                    left: 0,
                    child: Container(
                      width: 114.w,
                      clipBehavior: Clip.hardEdge,
                      decoration: BoxDecoration(
                          image: Styles.gradient.gradientImage,
                          borderRadius: BorderRadiusDirectional.only(
                              bottomEnd: Radius.circular(8.w),
                              bottomStart: Radius.circular(8.w))),
                      child: Row(
                        children: [
                          SizedBox(
                            width: 5.w,
                          ),
                          Image.asset(
                            'assets/player/play_num.png',
                            width: 12.w,
                          ),
                          SizedBox(
                            width: 5.w,
                          ),
                          Text(
                            '${model.videoNum}',
                            style:
                                TextStyle(color: Colors.white, fontSize: 12.w),
                          )
                        ],
                      ),
                    ))
              ],
            ),
            haveBg
                ? Image.asset(
                    'assets/player/play_bg.png',
                    width: 12.w,
                  )
                : const SizedBox.shrink()
          ],
        ),
        SizedBox(
          height: 6.w,
        ),
        SizedBox(
          width: haveBg ? 126.w : 114.w,
          child: Text(
            model.collectionName,
            maxLines: 1,
            overflow: TextOverflow.ellipsis,
            style: TextStyle(color: COLOR.hexColor('#ffffff'), fontSize: 12.w),
          ),
        )
      ],
    ).onOpaqueTap(() {
      Get.toBloggerCollectionDetail(model.collectionId);
    });
  }
}
